import { useEffect } from "react";

export function useMount(cb: () => void) {
  if (process.env.NODE_ENV === 'development') {
    if (typeof cb !== "function") {
      console.error(
        `useMount: parameter \`fn\` expected to be a function, but got "${typeof cb}".`,
      );
    }
  }

  useEffect(() => {
    cb?.();
  }, []);
}
